package com.organ.base.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.organ.base.entity.SysMenu;
import com.organ.base.service.SysMemberService;
import com.organ.base.util.Result;

/**
 * 员工可操作的控制层
 *
 */
@Controller
@RequestMapping("/member")
public class SysMemberController {
	@Autowired
	public SysMemberService memberService;

	@Autowired
	public HttpSession session;
	
	
	/**
	 * 根据当前登录用户权限获得菜单列表
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/getMenu",method=RequestMethod.GET)
	public Result getMenu(){
		List<SysMenu> menus= memberService.checkMenuAuthority(session);
		System.out.println(menus.toString());
		if(menus.size() > 0){
			return new Result(200, "查询成功",menus);
		}
		return new Result(302, "查询失败");
	}
}
